<?php $this->start('content1'); ?>
<head>
    <script type="text/javascript">
        function displayResult()
        {
            var phpLogin = document.getElementById("Tweet11Text").value ;
            var num = phpLogin.length;
            var num2 = 140;
            var num3 = num2 - num;
            document.getElementById("x").value = num3;
            var link = phpLogin.search("http");
            document.getElementById("x").value = num3;
            if(num3 < 0){
                document.getElementById("d").disabled = true;
            }
            else{
                document.getElementById("d").disabled = false;
                if(num3 ==140){
                    document.getElementById("d").disabled = true;
                }
            }
            if(link > -1){
                document.getElementById("d").disabled = false;
            }
        }
    </script>
</head>
<br />
<style type="text/css">
    .tweetbutton:enabled {
        -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
        -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
        box-shadow:inset 0px 1px 0px 0px #ffffff;
        background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #5ac5fa), color-stop(1, #3669c2) );
        background:-moz-linear-gradient( center top, #5ac5fa 5%, #3669c2 100% );
        filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#5ac5fa', endColorstr='#3669c2');
        background-color:#5ac5fa;
        -moz-border-radius:6px;
        -webkit-border-radius:6px;
        border-radius:6px;
        border:1px solid #4a569e;
        display:inline-block;
        color:#ffffff;
        font-family:arial;
        font-size:15px;
        font-weight:bold;
        float: right;
        padding:6px 24px;
        text-decoration:none;
    }.tweetbutton:disabled{
        -moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
        -webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
        box-shadow:inset 0px 1px 0px 0px #ffffff;
        background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #f0f0f0), color-stop(1, #f0f0f0) );
        background:-moz-linear-gradient( center top, #f0f0f0 5%, #f0f0f0 100% );
        filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#f0f0f0', endColorstr='#f0f0f0');
        background-color:#000000;
        -moz-border-radius:6px;
        -webkit-border-radius:6px;
        border-radius:6px;
        border:1px solid #4a569e;
        display:inline-block;
        color:#b8b8b8;
        font-family:arial;
        font-size:15px;
        font-weight:bold;
        float: right;
        padding:6px 24px;
        text-decoration:none;
    }.tweetbutton:hover:enabled {
        background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #3669c2), color-stop(1, #5ac5fa) );
        background:-moz-linear-gradient( center top, #3669c2 5%, #5ac5fa 100% );
        filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#3669c2', endColorstr='#5ac5fa');
        background-color:#3669c2;
    }.tweetbutton:active:enabled {
        position:relative;
        bottom:1px;
    }.tweetbox{
        resize: vertical;
        font-size: 12px;
        height: 60px;
        border-radius:6px;
        border:3px solid #b8b8b8;
    }
</style>
<?php
echo $this->Form->create();
echo $this->Form->textarea('Text', array("cols" => 5, "id" => "Tweet11Text", "placeholder" => "Compose new Tweet...","class" => "tweetbox", "onkeydown" => "displayResult()", "onkeyup" => "displayResult()", "onkeyup" => "displayResult()", "onselect" => "displayResult()", "onclick" => "displayResult()", "onchange" => "displayResult()"));
echo $this->Form->button('Tweet', array('id' => 'd', 'disabled' => 'disabled', 'class' => 'tweetbutton', 'type' => 'submit'));
echo $this->Form->input('  ', array('id' => 'x','class' => 'counter', 'value' => '140', 'disabled' => 'disabled'));
$this->end();
?>